import { writable, derived, readable, get as getVal } from "svelte/store";

export type StsCredential = {
  tmp_secret_id: string;
  // 临时密钥的 TmpSecretKey
  tmp_secret_key: string;
  // 临时密钥的 sessionToken
  session_token: string;
  // 临时密钥失效时间戳，是申请临时密钥时，时间戳加 durationSeconds
  expired_time: number;
  start_time: number;
  // 桶
  bucket: string;
  // 地区
  region: string;
};

export const defaultStsCredential: StsCredential = {
  tmp_secret_id: "",
  tmp_secret_key: "",
  session_token: "",
  expired_time: 0,
  start_time: 0,
  bucket: "",
  region: "",
};

export const stsCredential$ = writable<StsCredential>(defaultStsCredential);


